-
Notifications
You must be signed in to change notification settings - Fork 13
feat: #20 bootstrap data retrieve endpoint #46
Conversation
Codecov Report
@@ Coverage Diff @@
## master #46 +/- ##
==========================================
+ Coverage 87.56% 87.70% +0.13%
==========================================
Files 6 6
Lines 386 431 +45
==========================================
+ Hits 338 378 +40
- Misses 31 34 +3
- Partials 17 19 +2
Continue to review full report at Codecov.
|
pkg/restapi/operation/operations.go
Outdated
|
||
if err != nil { | ||
handleAuthError(w, http.StatusInternalServerError, | ||
fmt.Sprintf("failed to query transient store for handle : %s", err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found one! Extra space before colon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DRK3 fixed
pkg/restapi/operation/operations.go
Outdated
// but edge-core store API doesn't have a Delete() operation: https://github.com/trustbloc/edge-core/issues/45 | ||
_, err = w.Write(response) | ||
if err != nil { | ||
logger.Errorf("failed to write bootstrap data to output : %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DRK3 fixed
@@ -340,6 +346,48 @@ func (c *Operation) onboardUser(id string) (*user.Profile, error) { | |||
return userProfile, nil | |||
} | |||
|
|||
func (c *Operation) handleBootstrapDataRequest(w http.ResponseWriter, r *http.Request) { | |||
handle := r.URL.Query().Get("up") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is "up"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -17,6 +17,8 @@ import ( | |||
"strings" | |||
"testing" | |||
|
|||
"github.com/trustbloc/hub-auth/pkg/bootstrap/user" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DRK3 fixed
pkg/restapi/operation/operations.go
Outdated
KeyStoreIDs: profile.KeyStoreIDs, | ||
}) | ||
if err != nil { | ||
handleAuthError(w, http.StatusInternalServerError, fmt.Sprintf("failed to marshal bootstrap data : %s", err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DRK3 fixed
"github.com/trustbloc/hub-auth/pkg/bootstrap/user" | ||
|
||
"github.com/trustbloc/hub-auth/pkg/internal/common/mockoidc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These hub-auth imports should be grouped together with the other one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DRK3 fixed
} | ||
|
||
// TODO We should delete the handle from the transient store after writing the response, | ||
// but edge-core store API doesn't have a Delete() operation: https://github.com/trustbloc/edge-core/issues/45 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if not having the Delete() operation is blocking you and I can work on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DRK3 it's not blocking for now but should be there if we are going to say this thing is "production-ready"
Signed-off-by: George Aristy <[email protected]>
closes #20
This PR depends on PR #43 where the user's profile is stored to the transient store and the user is redirected to the UI with a handle in the
up
query parameter. This PR reuses that query parameter to fetch the same user bootstrap data.Two new startup parameters were added: SDS URL and Key Server URL.
Signed-off-by: George Aristy [email protected]